import {
  cdnBase
} from '../config/index';
const imgPrefix = cdnBase;

const defaultDesc = [`${imgPrefix}/goods/details-1.png`];

const allGoods = [{
    saasId: '88888888',
    storeId: '1000',
    spuId: '0',
    title: '织梦匠心之旅-三灶编织的研学旅行路线定制',
    primaryImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps1.png',
    images: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps1.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps1.png',
    ],
    video: null,
    available: 1,
    minSalePrice: 9800,
    minLinePrice: 9800,
    maxSalePrice: 9800,
    maxLinePrice: 9800,
    spuStockQuantity: 510,
    soldNum: 1020,
    isPutOnSale: 1,
    categoryIds: [
      '127880527393854975',
      '127880527393854976',
      '127880537778953984',
    ],
    specList: [{
      specId: '10013',
      title: '时长',
      specValueList: [{
          specValueId: '11013',
          specId: null,
          saasId: null,
          specValue: '半天',
          image: null,
        },
        {
          specValueId: '11014',
          specId: null,
          saasId: null,
          specValue: '全天',
          image: null,
        },
      ],
    }, ],
    skuList: [{
        skuId: '135676632',
        skuImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps1.png',
        specInfo: [{
            specId: '10013',
            specTitle: null,
            specValueId: '11013',
            specValue: null,
          },
          {
            specId: '10014',
            specTitle: null,
            specValueId: '11014',
            specValue: null,
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '29800',
            priceTypeName: null
          },
          {
            priceType: 2,
            price: '40000',
            priceTypeName: null
          },
        ],
        stockInfo: {
          stockQuantity: 158,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: {
          value: null,
          unit: 'KG'
        },
        volume: null,
        profitPrice: null,
      },
      {
        skuId: '135681631',
        skuImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps1.png',
        specInfo: [],
        priceInfo: [{
            priceType: 1,
            price: '29800',
            priceTypeName: null
          },
          {
            priceType: 2,
            price: '40000',
            priceTypeName: null
          },
        ],
        stockInfo: {
          stockQuantity: 177,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: {
          value: null,
          unit: 'KG'
        },
        volume: null,
        profitPrice: null,
      },
    ],
    spuTagList: [{
      id: '13001',
      title: '限时抢购',
      image: null
    }],
    limitInfo: [{
      text: '限购1件',
    }, ],
    desc: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps1.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps1.png',
    ],
    etitle: '',
  },

  {
    saasId: '88888888',
    storeId: '1000',
    spuId: '0',
    title: '【剪艺寻踪，三灶文化之旅】-三灶剪纸研学路线定制',
    primaryImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps2.png',
    images: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps2.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps2.png',
    ],
    video: null,
    available: 1,
    minSalePrice: 9800,
    minLinePrice: 9800,
    maxSalePrice: 9800,
    maxLinePrice: 9800,
    spuStockQuantity: 510,
    soldNum: 1020,
    isPutOnSale: 1,
    categoryIds: [
      '127880527393854975',
      '127880527393854976',
      '127880537778953984',
    ],
    specList: [{
      specId: '10013',
      title: '时长',
      specValueList: [{
          specValueId: '11013',
          specId: null,
          saasId: null,
          specValue: '半天',
          image: null,
        },
        {
          specValueId: '11014',
          specId: null,
          saasId: null,
          specValue: '全天',
          image: null,
        },
      ],
    }, ],
    skuList: [{
        skuId: '135676632',
        skuImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps1.png',
        specInfo: [{
            specId: '10013',
            specTitle: null,
            specValueId: '11013',
            specValue: null,
          },
          {
            specId: '10014',
            specTitle: null,
            specValueId: '11014',
            specValue: null,
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '29800',
            priceTypeName: null
          },
          {
            priceType: 2,
            price: '40000',
            priceTypeName: null
          },
        ],
        stockInfo: {
          stockQuantity: 158,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: {
          value: null,
          unit: 'KG'
        },
        volume: null,
        profitPrice: null,
      },
      {
        skuId: '135681631',
        skuImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps2.png',
        specInfo: [],
        priceInfo: [{
            priceType: 1,
            price: '29800',
            priceTypeName: null
          },
          {
            priceType: 2,
            price: '40000',
            priceTypeName: null
          },
        ],
        stockInfo: {
          stockQuantity: 177,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: {
          value: null,
          unit: 'KG'
        },
        volume: null,
        profitPrice: null,
      },
    ],
    spuTagList: [{
      id: '13001',
      title: '限时抢购',
      image: null
    }],
    limitInfo: [{
      text: '限购1件',
    }, ],
    desc: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps2.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps2.png',
    ],
    etitle: '',
  },
  {
    saasId: '88888888',
    storeId: '1000',
    spuId: '0',
    title: '【仙鹤之舞，三灶传承之旅】-三灶鹤舞研学路线定制',
    primaryImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps3.png',
    images: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps3.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps3.png',
    ],
    video: null,
    available: 1,
    minSalePrice: 9800,
    minLinePrice: 9800,
    maxSalePrice: 9800,
    maxLinePrice: 9800,
    spuStockQuantity: 510,
    soldNum: 1020,
    isPutOnSale: 1,
    categoryIds: [
      '127880527393854975',
      '127880527393854976',
      '127880537778953984',
    ],
    specList: [{
      specId: '10013',
      title: '时长',
      specValueList: [{
          specValueId: '11013',
          specId: null,
          saasId: null,
          specValue: '半天',
          image: null,
        },
        {
          specValueId: '11014',
          specId: null,
          saasId: null,
          specValue: '全天',
          image: null,
        },
      ],
    }, ],
    skuList: [{
        skuId: '135676632',
        skuImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps3.png',
        specInfo: [{
            specId: '10013',
            specTitle: null,
            specValueId: '11013',
            specValue: null,
          },
          {
            specId: '10014',
            specTitle: null,
            specValueId: '11014',
            specValue: null,
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '29800',
            priceTypeName: null
          },
          {
            priceType: 2,
            price: '40000',
            priceTypeName: null
          },
        ],
        stockInfo: {
          stockQuantity: 158,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: {
          value: null,
          unit: 'KG'
        },
        volume: null,
        profitPrice: null,
      },
      {
        skuId: '135681631',
        skuImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/wps3.png',
        specInfo: [],
        priceInfo: [{
            priceType: 1,
            price: '29800',
            priceTypeName: null
          },
          {
            priceType: 2,
            price: '40000',
            priceTypeName: null
          },
        ],
        stockInfo: {
          stockQuantity: 177,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: {
          value: null,
          unit: 'KG'
        },
        volume: null,
        profitPrice: null,
      },
    ],
    spuTagList: [{
      id: '13001',
      title: '限时抢购',
      image: null
    }],
    limitInfo: [{
      text: '限购1件',
    }, ],
    desc: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps3.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/wps3.png',
    ],
    etitle: '',
  },

  {
    saasId: '88888888',
    storeId: '1000',
    spuId: '0',
    title: '三灶编织文创笔筒      --实用且超级可爱的笔筒                                                                                                                             ',
    primaryImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织文创笔筒.png',
    images: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织文创笔筒.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织文创笔筒.png',
    ],
    video: null,
    available: 1,
    minSalePrice: 9800,
    minLinePrice: 9800,
    maxSalePrice: 9800,
    maxLinePrice: 9800,
    spuStockQuantity: 510,
    soldNum: 1020,
    isPutOnSale: 1,
    categoryIds: [
      '127880527393854975',
      '127880527393854976',
      '127880537778953984',
    ],
    specList: [{
      specId: '10013',
      title: '尺寸',
      specValueList: [{
          specValueId: '11012',
          specId: null,
          saasId: null,
          specValue: '中',
          image: null,
        },
        {
          specValueId: '11013',
          specId: null,
          saasId: null,
          specValue: '大',
          image: null,
        },
      ],
    }, ],
    skuList: [{
        skuId: '135676632',
        skuImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织文创笔筒.png',
        specInfo: [{
            specId: '10012',
            specTitle: null,
            specValueId: '10012',
            specValue: null,
          },
          {
            specId: '10013',
            specTitle: null,
            specValueId: '11013',
            specValue: null,
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '29800',
            priceTypeName: null
          },
          {
            priceType: 2,
            price: '40000',
            priceTypeName: null
          },
        ],
        stockInfo: {
          stockQuantity: 158,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: {
          value: null,
          unit: 'KG'
        },
        volume: null,
        profitPrice: null,
      },
      {
        skuId: '135681631',
        skuImage: 'https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-09a.png',
        specInfo: [{
            specId: '10011',
            specTitle: null,
            specValueId: '10012',
            specValue: null,
          },
          {
            specId: '10013',
            specTitle: null,
            specValueId: '10014',
            specValue: null,
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '29800',
            priceTypeName: null
          },
          {
            priceType: 2,
            price: '40000',
            priceTypeName: null
          },
        ],
        stockInfo: {
          stockQuantity: 177,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: {
          value: null,
          unit: 'KG'
        },
        volume: null,
        profitPrice: null,
      },
    ],
    spuTagList: [{
      id: '13001',
      title: '限时抢购',
      image: null
    }],
    limitInfo: [{
      text: '限购5件',
    }, ],
    desc: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织文创笔筒.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织文创笔筒.pngg',
    ],
    etitle: '',
  },



  {
    saasId: '88888888',
    storeId: '1000',
    spuId: '135686633',
    title: '三灶编织联名帆布袋                                                                   ',
    primaryImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织联名帆布袋.png',
    minSalePrice: '25900',
    minLinePrice: '31900',
    maxSalePrice: '26900',
    maxLinePrice: '31900',
    isSoldOut: false,
    images: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织联名帆布袋.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织联名帆布袋.png',
    ],
    groupIdList: ['15029', '14023'],
    spuTagList: [{
      id: null,
      title: '2024限量款',
      image: null,
    }, ],
    skuList: [{
        skuId: '135686634',
        skuImage: null,
        specInfo: [{
            specId: '10000',
            specTitle: null,
            specValueId: '10001',
            specValue: '白色',
          },
          {
            specId: '10002',
            specTitle: null,
            specValueId: '10003',
            specValue: 'M',
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '9800',
            priceTypeName: '销售价格',
          },
          {
            priceType: 2,
            price: '31900',
            priceTypeName: '划线价格',
          },
        ],
        stockInfo: {
          stockQuantity: -9,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: null,
        volume: null,
        profitPrice: null,
      },
      {
        skuId: '135691631',
        skuImage: null,
        specInfo: [{
            specId: '10000',
            specTitle: null,
            specValueId: '10001',
            specValue: '白色',
          },
          {
            specId: '10002',
            specTitle: null,
            specValueId: '11003',
            specValue: 'S',
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '6800',
            priceTypeName: '销售价格',
          },
          {
            priceType: 2,
            price: '31900',
            priceTypeName: '划线价格',
          },
        ],
        stockInfo: {
          stockQuantity: 177,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: null,
        volume: null,
        profitPrice: null,
      },
      {
        skuId: '135691632',
        skuImage: null,
        specInfo: [{
            specId: '10000',
            specTitle: null,
            specValueId: '10001',
            specValue: '白色',
          },
          {
            specId: '10002',
            specTitle: null,
            specValueId: '11002',
            specValue: 'L',
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '26900',
            priceTypeName: '销售价格',
          },
          {
            priceType: 2,
            price: '31900',
            priceTypeName: '划线价格',
          },
        ],
        stockInfo: {
          stockQuantity: 194,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: null,
        volume: null,
        profitPrice: null,
      },
    ],
    isAvailable: 1,
    spuStockQuantity: 371,
    soldNum: 1032,
    isPutOnSale: 1,
    specList: [{
        specId: '10000',
        title: '颜色',
        specValueList: [{
          specValueId: '10001',
          specId: '10000',
          saasId: '88888888',
          specValue: '白色',
          image: '',
        }, ],
      },
      {
        specId: '10002',
        title: '尺码',
        specValueList: [{
            specValueId: '11003',
            specId: '10002',
            saasId: '88888888',
            specValue: 'S',
            image: '',
          },
          {
            specValueId: '10003',
            specId: '10002',
            saasId: '88888888',
            specValue: 'M',
            image: '',
          },
          {
            specValueId: '11002',
            specId: '10002',
            saasId: '88888888',
            specValue: 'L',
            image: '',
          },
        ],
      },
    ],
    promotionList: null,
    minProfitPrice: null,
    etitle: '',
    desc: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织联名帆布袋.png',

    ],
  },


  {
    saasId: '88888888',
    storeId: '1000',
    spuId: '135691628',
    title: '三灶鹤舞文创遮阳伞',
    images: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶鹤舞文创遮阳伞.png',
    ],
    primaryImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/三灶鹤舞文创遮阳伞.png',
    minSalePrice: '10800',
    minLinePrice: '16800',
    maxSalePrice: '16800',
    maxLinePrice: '16800',
    groupIdList: ['15029', '14023'],
    isSoldOut: true,
    spuTagList: [{
      id: null,
      title: '人气推荐',
      image: null,
    }, ],
    skuList: [{
        skuId: '135686631',
        skuImage: null,
        specInfo: [{
            specId: '127904180600844800',
            specTitle: null,
            specValueId: '127904180768617216',
            specValue: '蓝色卡通',
          },
          {
            specId: '127904861604820480',
            specTitle: null,
            specValueId: '127904862494014208',
            specValue: '24骨',
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '9580',
            priceTypeName: '销售价格',
          },
          {
            priceType: 2,
            price: '16800',
            priceTypeName: '划线价格',
          },
        ],
        stockInfo: {
          stockQuantity: 0,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: null,
        volume: null,
        profitPrice: null,
      },
      {
        skuId: '135686632',
        skuImage: null,
        specInfo: [{
            specId: '127904180600844800',
            specTitle: null,
            specValueId: '127904180768617216',
            specValue: '蓝色卡通',
          },
          {
            specId: '127904861604820480',
            specTitle: null,
            specValueId: '127904862007474176',
            specValue: '26骨',
          },
        ],
        priceInfo: [{
            priceType: 1,
            price: '16800',
            priceTypeName: '销售价格',
          },
          {
            priceType: 2,
            price: '28800',
            priceTypeName: '划线价格',
          },
        ],
        stockInfo: {
          stockQuantity: 0,
          safeStockQuantity: 0,
          soldQuantity: 0,
        },
        weight: null,
        volume: null,
        profitPrice: null,
      },

      {
        specId: '127904861604820480',
        title: '尺码',
        specValueList: [{
          specValueId: '127904862494014208',
          specId: '127904861604820480',
          saasId: '88888888',
          specValue: '24骨',
          image: '',
        }],
      },
    ],
    promotionList: null,
    minProfitPrice: null,
    etitle: '',
    desc: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶鹤舞文创遮阳伞.png',
    ],
  },


  {
    saasId: '88888888',
    storeId: '1000',
    spuId: '135686623',
    title: '三灶编织原创挂坠',
    primaryImage: 'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织原创挂坠.png',
    images: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织原创挂坠.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织原创挂坠.png',
    ],
    minSalePrice: '9900',
    minLinePrice: '16900',
    maxSalePrice: '10900',
    maxLinePrice: '16900',
    isSoldOut: false,
    groupIdList: [
      '15029',
    ],
    spuTagList: [{
      id: null,
      title: '联名系列',
      image: null,
    }, ],
    skuList: [{
      skuId: '135686624',
      skuImage: null,
      specInfo: [{
          specId: '10000',
          specTitle: null,
          specValueId: '10001',
          specValue: '贵族青',
        },
        {
          specId: '10002',
          specTitle: null,
          specValueId: '10003',
          specValue: '经典套装',
        },
      ],
      priceInfo: [{
          priceType: 1,
          price: '9900',
          priceTypeName: '销售价格',
        },
        {
          priceType: 2,
          price: '16900',
          priceTypeName: '划线价格',
        },
      ],
      stockInfo: {
        stockQuantity: 98,
        safeStockQuantity: 0,
        soldQuantity: 0,
      },
      weight: null,
      volume: null,
      profitPrice: null,
    }, ],
    isAvailable: 1,
    spuStockQuantity: 598,
    soldNum: 102,
    isPutOnSale: 1,
    desc: [
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织原创挂坠.png',
      'https://gitee.com/super_yangfeng/yimg/raw/master/三灶编织原创挂坠.png',
    ],
    specList: [{
        specId: '10000',
        title: '颜色',
        specValueList: [{
          specValueId: '10001',
          specId: '10000',
          saasId: '88888888',
          specValue: '贵族青',
          image: '',
        }],
      },
      {
        specId: '10002',
        title: '尺码',
        specValueList: [{
          specValueId: '11003',
          specId: '10001',
          saasId: '88888888',
          specValue: '经典套装',
          image: '',
        }, ],
      },
    ],
    promotionList: null,
    minProfitPrice: null,
    etitle: '',
  },


];

/**
 * @param {string} id
 * @param {number} [available] 库存, 默认1
 */
export function genGood(id, available = 1) {
  const specID = ['135681624', '135681628'];
  if (specID.indexOf(id) > -1) {
    return allGoods.filter((good) => good.spuId === id)[0];
  }
  const item = allGoods[id % allGoods.length];
  return {
    ...item,
    spuId: `${id}`,
    available: available,
    desc: item?.desc || defaultDesc,
    images: item?.images || [item?.primaryImage],
  };
}